
const _m0 = require("protobufjs/minimal");

const protobufPackage = "circle.cctp.v1";
function createBaseMsgReceiveMessage() {
    return { from: "", message: new Uint8Array(0), attestation: new Uint8Array(0) };
}
 const MsgReceiveMessage = {
    encode(message, writer = _m0.Writer.create()){
        if (message.from !== "") {
            writer.uint32(10).string(message.from);
        }
        if (message.message.length !== 0) {
            writer.uint32(18).bytes(message.message);
        }
        if (message.attestation.length !== 0) {
            writer.uint32(26).bytes(message.attestation);
        }
        return writer;
    },

    decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgReceiveMessage();
    while (reader.pos < end) {
        const tag = reader.uint32();
        switch (tag >>> 3) {
            case 1:
                if (tag !== 10) {
                    break;
                }

                message.from = reader.string();
                continue;
            case 2:
                if (tag !== 18) {
                    break;
                }

                message.message = reader.bytes();
                continue;
            case 3:
                if (tag !== 26) {
                    break;
                }

                message.attestation = reader.bytes();
                continue;
        }
        if ((tag & 7) === 4 || tag === 0) {
            break;
        }
        reader.skipType(tag & 7);
    }
    return message;
},

fromJSON(object) {
    return {
        from: isSet(object.from) ? globalThis.String(object.from) : "",
        message: isSet(object.message) ? bytesFromBase64(object.message) : new Uint8Array(0),
        attestation: isSet(object.attestation) ? bytesFromBase64(object.attestation) : new Uint8Array(0),
    };
},

toJSON(message) {
    const obj = {};
    if (message.from !== "") {
        obj.from = message.from;
    }
    if (message.message.length !== 0) {
        obj.message = base64FromBytes(message.message);
    }
    if (message.attestation.length !== 0) {
        obj.attestation = base64FromBytes(message.attestation);
    }
    return obj;
},

create(base) {
    return MsgReceiveMessage.fromPartial(base);
},
fromPartial(object) {
    const message = createBaseMsgReceiveMessage();
    message.from = object.from ?? "";
    message.message = object.message ?? new Uint8Array(0);
    message.attestation = object.attestation ?? new Uint8Array(0);
    return message;
}
};

module.exports = {
    protobufPackage, MsgReceiveMessage
}